package com.bw.module_merchant.adapter

import android.widget.TextView


import com.bw.module_merchant.entity.EnterpriseRecordEntity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.module_merchant.R


class EnterpriseRecordAdapter :BaseQuickAdapter<EnterpriseRecordEntity, BaseViewHolder>(R.layout.item_marchant_list) {
    override fun convert(holder: BaseViewHolder, item: EnterpriseRecordEntity) {
        holder.getView<TextView>(R.id.name).setText(item.enterpriseName)
        holder.getView<TextView>(R.id.contactName).setText(item.contactName)
        holder.getView<TextView>(R.id.applicationArea).setText("${item.applicationArea}m²")
        holder.getView<TextView>(R.id.entryPersonnel).setText(item.entryPersonnel.toString())
        holder.getView<TextView>(R.id.status).setText(item.status)

        if (item.status == "已审核"){
            holder.getView<TextView>(R.id.status).setBackgroundResource(R.drawable.devices_success_bg)
        }else if (item.status == "驳回"){
            holder.getView<TextView>(R.id.status).setBackgroundResource(R.drawable.devices_error_bg)
        }else{
            holder.getView<TextView>(R.id.status).setBackgroundResource(R.drawable.devices_noraml_bg)
        }
    }
}